﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework;

namespace theguineasyndrome
{
    abstract public class Enemy : LevelElement
    {
        protected int direction;
        protected Vector2 spriteOrigin;
        protected bool onTheFloor;
        protected Animation animation;
        protected Rectangle collisionRectangle;

        public Enemy(Level level, Texture2D texture, Vector2 position)
            : base(level, texture, position)
        {
            direction = 1;
            onTheFloor = false;
            spriteOrigin = new Vector2();
            animation = null;
            collisionRectangle = new Rectangle(0, 0, texture.Width, texture.Height);
        }

        public virtual bool canBurn()
        {
            return true;
        }

        public Rectangle getCollisionRectangle()
        {
            return new Rectangle((int)CollisionLeft, (int)CollisionTop, collisionRectangle.Width, collisionRectangle.Height);
        }

        public float CollisionLeft
        {
            get { return Center.X - collisionRectangle.Width / 2; }
        }

        public float CollisionRight
        {
            get { return CollisionLeft + collisionRectangle.Right; }
        }

        public float CollisionTop
        {
            get { return position.Y + collisionRectangle.Y; }
        }

        public float CollisionBottom
        {
            get { return position.Y + collisionRectangle.Bottom; }
        }

        public override bool isDynamic()
        {
            return true;
        }

        public override void queueDrawing(Camera camera)
        {
            if (camera.isVisible(rectangle))
                level.queueObjectDrawing(this);
        }
    }
}
